/*
 * ItemType.cpp
 *
 *  Created on: 24.03.2009
 *      Author: Konan Andrej
 */

#include "ItemType.h"

ItemType::ItemType(): n(0)
{
    Fields.clear();
}

ItemType::ItemType( int a_n ): n(a_n)
{
	Fields.clear();

	for (int i=0; i<n; i++) Fields.push_back( "" );
	//Fields[3] = "hello!";
}

QString ItemType::Get( const int i ) const
{
	if ( i<0 || i>=n ) return "";

	return Fields[i];
}

int ItemType::Set( const int i, const QString& str )
{
	if ( i<0 || i>=n ) return range_error;

	Fields[i] = str;
	return ok;
}

//******************* STOCK ITEM METHODS *************************//

StockItem::StockItem( int a_n ): ItemType( a_n )
{

}

/*StockItem::StockItem( const ItemType& item )
{
    SetArticle( item.Get( 0 ) );
    SetDescription( item.Get( 1 ) );
    SetNumber( item.Get( 2 ).toInt() );
    SetFormat( item.Get( 3 ) );
}*/

void StockItem::SetNumber( const int number )
{
	Fields[2] = QString::number( number );
}


//******************* ORDER ITEM METHODS *************************//
OrderItem::OrderItem( int a_n ): ItemType( a_n )
{

}
